import java.util.Arrays;
import java.util.Scanner;

/**
 * 编程实现用户输入4个整数，按从大到小的顺序排列输出。
 */
public class MaoPaoPaiXu {
    public static void main(String[] args) {
        System.out.println("请依次输入四个整数：");
        Scanner sc = new Scanner(System.in);
        int [] arr = new int[4];
        int temp;
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }
        System.out.println("排序前数组为："+ Arrays.toString(arr));
        for (int i = 0; i < arr.length; i++) {
            for (int j = i+1;j<arr.length;j++){
                if (arr[i]<arr[j]){
                    temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }
        System.out.print("排序后数组为："+Arrays.toString(arr));
    }
}
